{# WIP features #}
{% macro og_preview() %}
    <meta property="og:title" content="{{ social::og_title() }}" />
    <meta property="og:type" content="website"/>
    {%- if current_url -%}
        <meta property="og:url" content="{{ current_url }}"/>
    {%- endif -%}
    <meta property="og:description" content="{{ social::og_description() }}"/>

    {%- if section -%}
        {%- if config.extra.og_preview_img -%}
        <meta property="og:image" content="{{ get_url(path=config.extra.og_preview_img) }}"/>
        {%- endif -%}

    {%- elif page -%}
        {%- if page.extra.og_image -%}
        <meta property="og:image" content="{{ current_url ~ page.extra.og_image | trim }}"/>
        {%- elif config.extra.og_preview_img -%}
        <meta property="og:image" content="{{ get_url(path=config.extra.og_preview_img) }}"/>
        {%- endif -%}
    {%- endif -%}{# ./if section #}

{% endmacro og_preview %}

 {% macro twitter_preview() %}
    {%- if page -%}
    {% if page.extra.og_image %}
    <meta name="twitter:card" content="summary_large_image">
    {% else %}
    <meta name="twitter:card" content="summary">
    {%- endif -%}
    {% else %}
    <meta name="twitter:card" content="summary">
    {%- endif -%}

    {% if config.extra.twitter_site -%}
    <meta name="twitter:site" content="{{ config.extra.twitter_site }}">
    {%- endif -%}

    {% if page %}
    {%- if page.extra.twitter_user -%}
    <meta name="twitter:creator" content="{{ page.extra.twitter_user }}">
    {%- elif config.extra.twitter_user -%}
    <meta name="twitter:creator" content="{{ config.extra.twitter_user }}">
    {%- endif -%}{# ./if page.extra.twitter_user #}
    {%- elif config.extra.twitter_user %}
    <meta name="twitter:creator" content="{{ config.extra.twitter_user }}">
    {%- endif %}{# ./if page #}
{% endmacro twitter_preview %}

{% macro og_description() %}
    {%- if section -%}
        {%-  if section.description -%}
            {{ section.description }}
        {%- else -%}
            {{ config.description }}
        {%- endif -%}
    {%- elif page -%}
        {%- if page.summary | string -%}
            {{ page.summary | striptags | truncate(length=200) }}
        {%- elif page.description -%}
            {{ page.description }}
        {%- else -%}
            {{ config.description }}
        {%- endif -%}
    {%- endif -%}
{% endmacro og_description %}
{% macro og_title() -%}
    {{ config.title }} -&nbsp;
    {%- if section -%}
        {%- if section.title -%}
            {{ section.title | striptags }}
        {%- else -%}
            {{ config.description }}
        {%- endif -%}
    {%- elif page -%}
        {%- if page.title -%}
            {{ page.title | striptags }}
        {%- else -%}
            {{ config.description }}
        {%- endif -%}
    {%- endif -%}
{% endmacro og_title %}
